package com.qfjy.homework.chenzhiyuan;

import java.util.ArrayList;
import java.util.List;

/**
 * @author:陈志远
 * @date:2022/6/29 23:02
 * @VERSION:1.0
 */
public class Goods {

    private String goodsName;
    private String type;
    private int price;
    private List<Goods> goodsList;

    public Goods(String goodsName, String type, int price) {
        this.goodsName = goodsName;
        this.type = type;
        this.price = price;
        goodsList = new ArrayList<Goods>();
    }
    public void add(Goods goods){
        goodsList.add(goods);
    }

    public void remove(Goods goods){
        goodsList.remove(goods);
    }

    @Override
    public String toString(){
        return ("Goods :[ goodsName : "+ goodsName
                +", type : "+ type + ", price :"
                + price+" ]");
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public List<Goods> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<Goods> goodsList) {
        this.goodsList = goodsList;
    }
}
